Skip to content

Add multi-language Copilot SDK driver samples and wire daily workflows to exercise runtime installs#36734

Merged
pelikhan merged 12 commits into
mainfrom
copilot/add-copilot-sdk-driver-samples
Jun 4, 2026
Merged

Add multi-language Copilot SDK driver samples and wire daily workflows to exercise runtime installs#36734
pelikhan merged 12 commits into
mainfrom
copilot/add-copilot-sdk-driver-samples

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 3, 2026

This PR adds minimal Copilot SDK driver samples for each supported script language and assigns them to daily Copilot SDK workflows. The goal is to ensure runtime-specific Copilot SDK installation paths are exercised continuously in real workflow runs.

  • Driver samples in repository

    • Added .github/drivers/ with minimal script drivers for:
      • Node (.cjs)
      • Python (.py)
      • TypeScript (.ts)
      • Ruby (.rb)
    • Each sample is a self-contained SDK program that creates a client, creates a session, runs prompts, and writes the assistant result to stdout (no delegation to copilot_sdk_driver.cjs).
    • COPILOT_MODEL is a required environment variable in all sample drivers; each driver fails fast with a clear error when it is not set.
  • Daily workflow assignment

    • Updated daily Copilot SDK workflows to use language-specific engine.copilot-sdk-driver values as full workspace-relative paths (e.g. .github/drivers/copilot_sdk_driver_sample_python.py) so each runtime path is covered by scheduled automation.
  • Copilot SDK execution path

    • Removed implicit .github/drivers path prefix from the execution engine. The copilot-sdk-driver field value is now used directly as a workspace-relative path (${GITHUB_WORKSPACE}/<value>). Callers must always specify the full relative path from the workspace root.
  • Validation

    • Updated validateEngineCopilotSDKDriver to allow /-separated relative paths with safe segments while rejecting absolute paths, .., backslashes, shell metacharacters, empty segments (consecutive //, trailing /), and unsupported extensions.
    • Updated the JSON schema pattern for copilot-sdk-driver to match the new path format.
  • Runtime install mapping

    • Updated TypeScript driver runtime detection/install path to provision ts-node + typescript alongside @github/copilot-sdk, so .ts/.mts drivers execute without extra manual setup.
  • Specification and docs

    • Updated copilot-sdk-driver-specification.md to mark COPILOT_MODEL as a required standalone environment variable with a MUST constraint, and updated the non-normative TypeScript example accordingly.
    • Updated engines.md reference docs to show full workspace-relative path examples and document COPILOT_MODEL as required.
engine:
  id: copilot
  copilot-sdk: true
  copilot-sdk-driver: .github/drivers/copilot_sdk_driver_sample_typescript.ts

Copilot AI and others added 2 commits June 3, 2026 21:18
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add Copilot SDK driver samples and wire daily workflows Add multi-language Copilot SDK driver samples and wire daily workflows to exercise runtime installs Jun 3, 2026
Copilot AI requested a review from pelikhan June 3, 2026 21:23
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 3, 2026

@copilot the sample drivers should be self-contained programs that use the copilot SDK APIs in each language to create a client, create a session, run prompts, and output the result to the console. Do not spawn copilot_sdk_driver.cjs

Copilot AI and others added 3 commits June 3, 2026 21:46
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot the sample drivers should be self-contained programs that use the copilot SDK APIs in each language to create a client, create a session, run prompts, and output the result to the console. Do...

Addressed in c844585. The sample drivers are now self-contained SDK flows: Node/TypeScript/Python create a client, create a session, run the prompt from GH_AW_PROMPT, and print assistant output directly. The Ruby sample no longer delegates to copilot_sdk_driver.cjs and runs its own inline SDK flow.

@pelikhan pelikhan marked this pull request as ready for review June 3, 2026 21:51
Copilot AI review requested due to automatic review settings June 3, 2026 21:51
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 3, 2026

@copilot

  • merge main, recompile
  • update specification and docs and sample drivers that COPILOT_MODEL is a REQUIRED environment variable

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds minimal Copilot SDK driver samples in multiple scripting languages and updates daily Copilot SDK workflows so scheduled runs exercise runtime-specific installation and execution paths (including custom driver resolution from the repository workspace).

Changes:

  • Added .github/drivers/ sample SDK drivers (Node, TypeScript, Python, Ruby) and configured daily workflows to use them via engine.copilot-sdk-driver.
  • Updated Copilot engine execution to resolve custom SDK drivers from ${GITHUB_WORKSPACE}/.github/drivers instead of the setup-action directory.
  • Updated Copilot SDK install mapping so TypeScript drivers install ts-node + typescript alongside @github/copilot-sdk.
Show a summary per file
File Description
pkg/workflow/copilot_engine_test.go Updates tests for custom-driver resolution path and TypeScript install expectations.
pkg/workflow/copilot_engine_installation.go Adds a TypeScript-specific SDK install spec and runtime detection for ts-node.
pkg/workflow/copilot_engine_execution.go Resolves custom SDK drivers from workspace .github/drivers and adjusts command formatting.
.github/workflows/daily-workflow-updater.md Sets the daily updater to use the Ruby sample SDK driver.
.github/workflows/daily-workflow-updater.lock.yml Regenerated lockfile reflecting the Ruby driver wiring/execution.
.github/workflows/daily-skill-optimizer.md Sets the daily skill optimizer to use the TypeScript sample SDK driver.
.github/workflows/daily-skill-optimizer.lock.yml Regenerated lockfile reflecting the TypeScript driver install/execution.
.github/workflows/daily-model-inventory.md Sets the daily model inventory workflow to use the Node sample SDK driver.
.github/workflows/daily-model-inventory.lock.yml Regenerated lockfile reflecting the Node driver wiring/execution.
.github/workflows/daily-issues-report.md Sets the daily issues report workflow to use the Python sample SDK driver.
.github/workflows/daily-issues-report.lock.yml Regenerated lockfile reflecting the Python driver install/execution.
.github/drivers/copilot_sdk_driver_sample_typescript.ts New TypeScript Copilot SDK driver sample.
.github/drivers/copilot_sdk_driver_sample_ruby.rb New Ruby (Node-embedded) Copilot SDK driver sample.
.github/drivers/copilot_sdk_driver_sample_python.py New Python Copilot SDK driver sample.
.github/drivers/copilot_sdk_driver_sample_node.cjs New Node Copilot SDK driver sample.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 15/15 changed files
  • Comments generated: 5

Comment on lines 268 to 269
driverRuntimeCmd, driverArg := copilotSDKDriverExecArgs(sdkDriverScriptName)
if driverArg != "" {
onPermissionRequest: approveAll,
...(model ? { model } : {}),
});
const response = await session.sendAndWait({ prompt });
...(model ? { model } : {}),
});

const response = await session.sendAndWait({ prompt });
onPermissionRequest: approveAll,
...(model ? { model } : {}),
});
const response = await session.sendAndWait({ prompt });
if model:
create_kwargs["model"] = model
session = await client.create_session(**create_kwargs)
response = await session.send_and_wait(prompt)
Copilot AI and others added 2 commits June 3, 2026 22:07
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot

  • merge main, recompile
  • update specification and docs and sample drivers that COPILOT_MODEL is a REQUIRED environment variable

Done in commits 1373e53 (main merged + lock files recompiled) and 9f6a72e:

  • Spec (copilot-sdk-driver-specification.md): COPILOT_MODEL updated to Required: Yes with MUST be non-empty; implementations MUST fail fast when unset, and the TypeScript example now validates model alongside the other required vars before proceeding.
  • Sample drivers: All four (node, typescript, python, ruby) now call their respective readRequiredEnv/read_required_env/requiredEnv helper for COPILOT_MODEL and pass it directly to createSession/create_session without any optional spreading.

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 3, 2026

@copilot merge main and recompile

…dk-driver-samples

# Conflicts:
#	.github/workflows/daily-issues-report.lock.yml
#	.github/workflows/daily-model-inventory.lock.yml
#	.github/workflows/daily-skill-optimizer.lock.yml
#	.github/workflows/daily-workflow-updater.lock.yml
#	docs/src/content/docs/reference/copilot-sdk-driver-specification.md

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot merge main and recompile

Done — merged main (resolving conflicts in 4 lock files and the spec, keeping our COPILOT_MODEL as required) and recompiled all 239 workflows in the latest commit.

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Jun 3, 2026

@copilot remove implicit support for .github/drivers folder. Always use full relative path to workfspace root in copilot-sdk-driver field.

Copilot AI and others added 2 commits June 3, 2026 22:54
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…shell-safety comment

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 3, 2026

@copilot remove implicit support for .github/drivers folder. Always use full relative path to workfspace root in copilot-sdk-driver field.

Done. The implicit .github/drivers path prefix has been removed from the execution engine — copilot-sdk-driver values are now used directly as workspace-relative paths (e.g. .github/drivers/copilot_sdk_driver_sample_python.py). All four daily workflows and the validation/schema logic have been updated accordingly.

Also addressed two follow-up issues from code review:

  • Empty path segments (foo//bar, foo/) are now explicitly rejected by validation (commit $(git rev-parse --short HEAD))
  • Added a clarifying comment in the execution path confirming the validated value is safe to embed in the shell command

@pelikhan pelikhan merged commit da79357 into main Jun 4, 2026
@pelikhan pelikhan deleted the copilot/add-copilot-sdk-driver-samples branch June 4, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants